﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Admin.WorkFlow
{
    public partial class FlowFrameWork : System.Web.UI.Page
    {
        #region 变量信息
        public string iframeHeight = "";
        public string sScript = "";
        public string nodeid = "";
        private string FlowId = "";
        private string NodeName = "";
        private string NodeUserName = "";
        private string NodeUserAccount = "";
        public string State = "";
        private string PreState = "";
        public string PreBtMsg = "";
        private string NextState = "";
        public string NextBtMsg = "";
        private string type = "";
        private string MsgSelect = "";
        public string modifyForm = "";


        private string MsgNode = "";
        private string CAWord = "";
        private string Attach = "";
        //========================================
        private string typeValue = "";
        private string ReceiveFormValue = "";
        private string ReceiveNodeValue = "";
        private string NextNodeUserName = "";
        private string NextNodeUserAccount = "";
        public string NextNodeId = "";
        public string NextNode = "";
        //========================================
        private string PreNodeUserName = "";
        private string PreNodeUserAccount = "";
        public string PreNodeId = "";
        public string PreNode = "";
        public string strWhere = "";
        //是否直接归档
        public bool BSaveForm = false;
        #endregion
        ChinaSoft.BLL.BLL_tb_MidSoft_PmFlow PmFlowBll = new ChinaSoft.BLL.BLL_tb_MidSoft_PmFlow();
        ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowAttach PmFlowAttachBll = new ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowAttach();
        ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowNode PmFlowNodeBll = new ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowNode();
        ChinaSoft.BLL.BLL_tb_MidSoft_ProjectInfo ProjectInfoBll = new ChinaSoft.BLL.BLL_tb_MidSoft_ProjectInfo();
        ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowMessage PmFlowMessageBll = new ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowMessage();
        ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowReceive PmFlowReceiveBll = new ChinaSoft.BLL.BLL_tb_MidSoft_PmFlowReceive();
        ChinaSoft.BLL.BLL_tb_MidSoft_DepartMent DepartMentBll = new ChinaSoft.BLL.BLL_tb_MidSoft_DepartMent();
        ChinaSoft.Model.Model_tb_MidSoft_PmFlowMessage PmFlowMessageModel = new ChinaSoft.Model.Model_tb_MidSoft_PmFlowMessage();
        ChinaSoft.Model.Model_tb_MidSoft_PmFlowReceive PmFlowReceiveModel = new ChinaSoft.Model.Model_tb_MidSoft_PmFlowReceive();
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Validate
            if (Session["UserName"] == null)
            {
                Response.Redirect("/login.aspx");
                Response.End();
            }
            #endregion
            #region Request
            if (Request.QueryString["nodeid"] != null && Request.QueryString["nodeid"].ToString() != "")
            {
                ViewState["nodeid"] = Request.QueryString["nodeid"];
            }
            if (Request.QueryString["projectid"] != null && Request.QueryString["projectid"].ToString() != "")
            {
                ViewState["projectid"] = Request.QueryString["projectid"];
            }
            if (Request.QueryString["formid"] != null && Request.QueryString["formid"].ToString() != "")
            {
                ViewState["formid"] = Request.QueryString["formid"];
            }
            if (Request.QueryString["flowid"] != null && Request.QueryString["flowid"].ToString() != "")
            {
                ViewState["flowid"] = Request.QueryString["flowid"];
            }
            if (Request.QueryString["state"] != null && Request.QueryString["state"].ToString() != "")
            {
                ViewState["state"] = Request.QueryString["state"];
            }
            #endregion
            #region Process
            GetNodeValue();
            if (!IsPostBack)
            {
                //按钮状态
                BtStatus();
                //设置消息发送助理
                SetMsgPasser();
            }
            //得到主题名称
            getTitle();
            //发消息给自己
            SendMsgToSelf();
            //显示节点名称
            lbYj.Text = NodeName;
            //表单验证
            FormValidate();
            #endregion
        }
        private void FormValidate()
        {
            //string StrSql = "select * from Pm_Flow where id='" + +"' and formtype='无'";

            //DataTable dt = PmFlowBll.GetList("PmFlowId='" + ViewState["flowid"].ToString() + "'").Tables[0];
            //if (dt.Rows.Count > 0)
            //{
            //    divmsg.Visible = false;
            //    msgPanel.Visible = false;
            //    iframeHeight = "720px";
            //}
            //else
            //{
            //    StrSql = "select * from Pm_Flow_Node where id='" + ViewState["nodeid"].ToString() + "' and formtype='无'";
            //    dt.Clear();
            //    dt = database.getTable(StrSql);
            //    if (dt.Rows.Count > 0)
            //    {
            //        divmsg.Visible = false;
            //        msgPanel.Visible = false;
            //        iframeHeight = "720px";
            //        msgReceive.Visible = true;
            //    }
            //    else
            //    {
            //        StrSql = "select * from Pm_Flow_Node where id='" + ViewState["nodeid"].ToString() + "'";
            //        dt.Clear();
            //        dt = database.getTable(StrSql);
            //        iframeHeight = "400px";
            //        if (State == "88" && NextState == "88" && dt.Rows[0]["nextbtmsg"].ToString() != "无")
            //        {
            //            divmsg.Visible = false;
            //            tbNgr.Visible = false;
            //            btGd.Visible = true;
            //            btGd.Text = dt.Rows[0]["nextbtmsg"].ToString();
            //            btGd.Attributes.Add("onclick", "return confirm('您确认归档吗？')");
            //            //msgReceive.Visible = true;
            //            BSaveForm = true;
            //        }
            //        else if (State == "88" && NextState == "88")
            //        {
            //            divmsg.Visible = false;
            //            tbNgr.Visible = false;
            //            btGd.Visible = true;
            //            btGd.Text = "收到";
            //            btGd.Attributes.Add("onclick", "return confirm('您确认收到吗？')");
            //            msgReceive.Visible = true;
            //        }
            //        else if (NextState == "88" && ViewState["state"] != null && ViewState["state"].ToString() == "3")
            //        {
            //            divmsg.Visible = false;
            //            tbNgr.Visible = false;
            //            btGd.Visible = true;
            //            btGd.Text = "全部收到，完成";
            //            btGd.Attributes.Add("onclick", "return confirm('您确认全部收到完成吗？')");
            //            msgReceive.Visible = true;
            //        }
            //        else if (NextState == "88" && dt.Rows[0]["nextbtmsg"].ToString() == "确认通过")
            //        {
            //            sScript = "<script>s = divmsg.innerHTML;divmsg.innerHTML = '';s=s.replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param');divspan.innerHTML = s;</script>";
            //            BSaveForm = true;
            //        }
            //        else if (NextState == "88" && dt.Rows[0]["nextbtmsg"].ToString() != "无")
            //        {
            //            BSaveForm = true;
            //            sScript = "<script>s = divmsg.innerHTML;divmsg.innerHTML = '';s=s.replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param');divspan.innerHTML = s;</script>";
            //        }
            //        else
            //        {
            //            sScript = "<script>s = divmsg.innerHTML;divmsg.innerHTML = '';s=s.replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param').replace('yckparam','param');divspan.innerHTML = s;</script>";
            //        }
            //    }
            //}
            if (ViewState["formid"] != null)
            {
                //如果存在附件，则将附件显示
                int iCount = PmFlowAttachBll.GetRecordCount("FlowId='" + ViewState["flowid"].ToString() + "' and FormId='" + ViewState["formid"].ToString() + "'");
                if (iCount > 0)
                {
                    tbAttach.Visible = true;
                }
            }

        }
        private void SetMsgPasser()
        {
            //查看是否是消息节点，不是消息节点时，显示拟稿人消息
            int iCount = PmFlowNodeBll.GetRecordCount("PmFlowNodeId='" + ViewState["nodeid"].ToString() + "' and HaveMsgNode='否'");
            if (iCount > 0)
            {
                tbNgr.Visible = true;
            }
        }
        private void getTitle()
        {
            //取到项目名称
            labTitle.Text = ProjectInfoBll.GetList("ProjectInfoId='" + ViewState["formid"].ToString() + "'").Tables[0].Rows[0]["ProjectName"].ToString();
            //取到流程名称
            labFlowType.Text = PmFlowBll.GetList("PmFlowId='" + ViewState["flowid"].ToString() + "'").Tables[0].Rows[0]["FlowName"].ToString();
        }
        private void SendMsgToSelf()
        {
            //string formid = "";
            //if (ViewState["formid"] != null)
            //{
            //    if (Request.QueryString["noform"] == null)
            //    {
            //        DataBase database = new DataBase();
            //        formid = ViewState["formid"].ToString();
            //        string StrSql = "select * from Pm_Flow_State where Formid='" + formid + "' and FlowId='" + ViewState["flowid"].ToString() + "' and useraccount='" + Session["UserAccount"] + "'";
            //        if (database.getTable(StrSql).Rows.Count < 1)
            //        {
            //            StrSql = "insert into Pm_Flow_State(FlowId,Formid,NodeId,useraccount,username,node,state)values('" + ViewState["flowid"].ToString() + "','" + ViewState["formid"].ToString() + "','" + ViewState["nodeid"] + "','" + Session["UserAccount"] + "','" + Session["UserName"] + "','1','1')";
            //            database.ExecuteSql(StrSql);
            //        }
            //        database.CloseConn();
            //    }
            //    else if (Request.QueryString["noform"] != null && Request.QueryString["noform"].ToString() != "yes")
            //    {
            //        DataBase database = new DataBase();
            //        formid = ViewState["formid"].ToString();
            //        string StrSql = "select * from Pm_Flow_State where Formid='" + formid + "' and FlowId='" + ViewState["flowid"].ToString() + "'";
            //        if (database.getTable(StrSql).Rows.Count < 1)
            //        {
            //            StrSql = "insert into Pm_Flow_State(FlowId,Formid,NodeId,useraccount,username,node,state)values('" + ViewState["flowid"].ToString() + "','" + ViewState["formid"].ToString() + "','" + ViewState["nodeid"] + "','" + Session["UserAccount"] + "','" + Session["UserName"] + "','1','1')";
            //            database.ExecuteSql(StrSql);
            //        }
            //        database.CloseConn();
            //    }
            //}
        }
        private void BtStatus()
        {
            btPre.Text = PreBtMsg;
            btNext.Text = NextBtMsg;
            btPre.Attributes.Add("onclick", "return confirm('您确认" + PreBtMsg + "吗?')");
            if (type == "选人节点")
            {
                btNext.Attributes.Add("onclick", "SelectUsers('" + typeValue + "','" + NextState + "');return false;");
            }
            else
            {
                btNext.Attributes.Add("onclick", "return confirm('您确认" + NextBtMsg + "吗?')");
            }
            if (PreState != "0")
            {
                btPre.Visible = true;
            }
            if (NextState != "88")
            {
                btNext.Visible = true;
            }

            if (Attach == "有")
            {
                btAttach.Visible = true;
            }
            if (NextBtMsg == "没有")
            {
                btNext.Visible = false;
            }
        }

        private void GetNodeValue()
        {
            DataTable dt = ProjectInfoBll.GetList("PmFlowNodeId='" + ViewState["nodeid"].ToString() + "'").Tables[0];

            nodeid = dt.Rows[0]["PmFlowNodeId"].ToString();
            FlowId = dt.Rows[0]["PmFlowId"].ToString();
            NodeName = dt.Rows[0]["NodeName"].ToString();
            NodeUserName = dt.Rows[0]["DeafaultReceiveUserName"].ToString();
            NodeUserAccount = dt.Rows[0]["DeafaultReceiveUserAccount"].ToString();
            State = dt.Rows[0]["State"].ToString();
            PreState = dt.Rows[0]["PreState"].ToString();
            PreBtMsg = dt.Rows[0]["PreBtValue"].ToString();
            NextState = dt.Rows[0]["NextState"].ToString();
            NextBtMsg = dt.Rows[0]["NextBtValue"].ToString();
            type = dt.Rows[0]["NodeType"].ToString();
            Attach = dt.Rows[0]["HaveAttach"].ToString();
            MsgSelect = dt.Rows[0]["DefaultMsgContent"].ToString();
            modifyForm = dt.Rows[0]["ModifyForm"].ToString();
            if (dt.Rows[0]["ModifyButton"].ToString() == "显示")
            {
                btEdit.Visible = true;
            }
            MsgNode = dt.Rows[0]["HaveMsgNode"].ToString();
            //CAWord = dt.Rows[0]["CAWord"].ToString();
            //如果不是归档
            if (!(NextState == "88" && State == "88"))
            {
                string strWhere="FlowId='" + ViewState["flowid"].ToString() + "' and State='" + NextState + "'";
                dt = PmFlowNodeBll.GetList(strWhere).Tables[0];
                //如果是普通节点
                if (dt.Rows.Count > 0)
                {
                    NextNodeUserName = dt.Rows[0]["DeafaultReceiveUserName"].ToString();
                    NextNodeUserAccount = dt.Rows[0]["DeafaultReceiveUserAccount"].ToString();
                    NextNodeId = dt.Rows[0]["PmFlowNodeId"].ToString();
                    NextNode = dt.Rows[0]["state"].ToString();
                    ReceiveNodeValue = dt.Rows[0]["ReceiveNodeValue"].ToString();
                    ReceiveFormValue = dt.Rows[0]["ReceiveFormValue"].ToString();
                    //如果节点有指定有值
                    if (ReceiveNodeValue != null && ReceiveNodeValue != "")
                    {
                        strWhere = "ProjectInfoId='" + ViewState["projectid"].ToString() + "' and FlowId='" + ViewState["flowid"].ToString() + "' and FlowFormId='" + ViewState["formid"].ToString() + "' and ReceiveNodeValue='" + ReceiveNodeValue + "'";
                        dt = PmFlowReceiveBll.GetList(strWhere).Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            NextNodeUserName = dt.Rows[0]["UserName"].ToString();
                            NextNodeUserAccount = dt.Rows[0]["UserAccount"].ToString();
                        }
                    }
                        //如果表单指导有值
                    else if (ReceiveFormValue != null && ReceiveFormValue != "")
                    {
                        strWhere = "ProjectInfoId='" + ViewState["projectid"].ToString() + "' and FlowId='" + ViewState["flowid"].ToString() + "' and FlowFormId='" + ViewState["formid"].ToString() + "' and ReceiveFormValue='" + ReceiveFormValue + "'";
                        dt = PmFlowReceiveBll.GetList(strWhere).Tables[0];
                        if (dt.Rows.Count > 0)
                        {
                            NextNodeUserName = dt.Rows[0]["UserName"].ToString();
                            NextNodeUserAccount = dt.Rows[0]["UserAccount"].ToString();
                        }
                    }
                }
                //如果是送本部门领导节点
                if (type == "送领导节点")
                {
                    dt = DepartMentBll.GetList("department='" + Session["UserDepartMentUse"] + "'").Tables[0];
                   
                    if (dt.Rows.Count > 0)
                    {
                        NextNodeUserName = dt.Rows[0]["DepartMentLeaderName"].ToString();
                        NextNodeUserAccount = dt.Rows[0]["DepartMentLeaderAccount"].ToString();
                    }
                }
            }
            //往回找人
            if (PreState != "0")
            {
                //获取前一节点
                strWhere = "FlowId='" + ViewState["flowid"].ToString() + "' and State='" + PreState + "'";
                dt = PmFlowNodeBll.GetList(strWhere).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    PreNodeUserName = dt.Rows[0]["NodeUserName"].ToString();
                    PreNodeUserAccount = dt.Rows[0]["NodeUserAccount"].ToString();
                    PreNodeId = dt.Rows[0]["PmFlowNodeId"].ToString();
                    PreNode = dt.Rows[0]["state"].ToString();
                }
                //如果上一节点人员是空的，从流程中找
                if (PreNodeUserAccount == "")
                {
                    strWhere="FlowId='" + ViewState["flowid"].ToString() + "' and FlowFormId='" + ViewState["formid"].ToString() + "' and FlowNodeId='" + PreNodeId + "'";
                    dt=PmFlowReceiveBll.GetList(strWhere).Tables[0];
                    PreNodeUserName = dt.Rows[0]["UserName"].ToString();
                    PreNodeUserAccount = dt.Rows[0]["UserAccount"].ToString();
                }
            }
        }
        public string GetContent(string strNodId)
        {
            DataTable dt = PmFlowMessageBll.GetList(100, "ProjectInfoId='" + ViewState["projectid"].ToString() + "' and FlowId='" + ViewState["flowid"].ToString() + "' and FormId='" + ViewState["formid"].ToString() + "' and NodeId='" + ViewState["nodeid"].ToString() + "'", "FlowMessageId desc").Tables[0];

            string strTable = "<table width=100%>";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                strTable += "<tr><td>" + dt.Rows[i]["MsgContent"].ToString() + "</td><td  width=250px>" + dt.Rows[i]["UserName"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;" + dt.Rows[i]["CreateDate"].ToString() + "</td></tr>";
            }
            strTable += "</table>";
            if (ViewState["nodeid"].ToString() == strNodId)
            {
                return strTable + "<br><div id=\"divspan\"></div>";
            }
            else
            {
                return strTable;
            }
        }
        /// <summary>
        /// 查询状态
        /// </summary>
        /// <param name="strState"></param>
        /// <returns></returns>
        public string GetState(string strState)
        {
            if (strState == "2")
            {
                return "<font color=blue>已收</font>";
            }
            else
            {
                return "<font color=red>未收</font>";
            }
        }
        /// <summary>
        /// 回退发送
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btPre_Click(object sender, EventArgs e)
        {
            if (ViewState["formid"] == null)
            {
                Response.Write("<script>alert('流程没有发现表单！')</script>");
            }
            else
            {
                string strMsg = "";//;;
                if (txtMsg.Text != "同意")
                {
                    strMsg = txtMsg.Text;
                }
                //添加消息
                InsertMessage("");
                //插入下一个办理人
                InsertNextUser(PreNodeUserAccount,PreNodeUserName, 1);
                //更新本人状态
                UpdateReceiveUserState();
                //页面关闭
                Response.Write("<script>window.opener.location=window.opener.location</script>");
                Response.Write("<script>window.close()</script>");
            }
        }
        /// <summary>
        /// 发送下一环节操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btNext_Click(object sender, EventArgs e)
        {
            if (ViewState["formid"] == null)
            {
                Response.Write("<script>alert('流程没有发现表单！')</script>");
            }
            else
            {
                //添加消息
                InsertMessage("(同意)");
                //插入下一个办理人
                InsertNextUser(NextNodeUserAccount,NextNodeUserName,1);
                //更新本人状态
                UpdateReceiveUserState();
                //发送RTX
                //SendRtx(NextNodeUserName, labTitle.Text);
                //页面关闭
                Response.Write("<script>window.opener.location=window.opener.location</script>");
                Response.Write("<script>window.close()</script>");
            }
        }
       /// <summary>
       /// 选人操作
       /// </summary>
       /// <param name="sender"></param>
       /// <param name="e"></param>
        protected void btSelectMans_Click(object sender, EventArgs e)
        {
            if (ViewState["formid"] == null)
            {
                Response.Write("<script>alert('流程没有发现表单！')</script>");
            }
            else
            {
                string strMsg = "确认";
                if (MsgSelect != "")
                {
                    strMsg = MsgSelect;
                }
                //获取选择的消息，如果消息中有* 采用当前接收人的姓名替换（除本人）
               if (strMsg.IndexOf("*") > 0)
                {
                    string strWhere = "ProjectInfoId='" + ViewState["projectid"].ToString() + "' and FlowId='" + ViewState["flowid"].ToString() + "' and FlowFormId='" + ViewState["formid"].ToString() + "' and UserAccount<>'" + Session["UserAccount"].ToString() + "' and state=1";
                    DataTable dt = PmFlowReceiveBll.GetList(strWhere).Tables[0];
                    if (dt.Rows.Count > 0)
                        strMsg = strMsg.Replace("*", dt.Rows[0]["UserName"].ToString());
                }

               //添加消息
               InsertMessage(strMsg);
               //更新本人状态
               UpdateReceiveUserState();
               //发送RTX
               //SendRtx(NextNodeUserName, labTitle.Text);
                Response.Write("<script>window.opener.location=window.opener.location</script>");
                Response.Write("<script>window.close()</script>");
            }
        }
        /// <summary>
        /// 归档操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btGd_Click(object sender, EventArgs e)
        {
            //添加消息
            InsertMessage("归档完成！");
            //更新本人状态
            UpdateReceiveUserState();
        }
        /// <summary>
        /// 更新本人状态
        /// </summary>
        private void UpdateReceiveUserState()
        {
            PmFlowReceiveModel = PmFlowReceiveBll.GetModelList("ProjectInfoId='" + ViewState["projectid"].ToString() + "' and FlowId='" + ViewState["flowid"].ToString() + "' and FlowFormId='" + ViewState["formid"].ToString() + "' and FlowNodeId='" + ViewState["nodeid"].ToString() + "' and state=1 and UserAccount='" + Session["UserAccount"].ToString() + "'")[0];
            PmFlowReceiveModel.State = 2;
            PmFlowReceiveBll.Update(PmFlowReceiveModel);
        }
        /// <summary>
        /// 消息添加
        /// </summary>
        /// <param name="strMsg"></param>
        private void InsertMessage(string strMsg)
        {
            PmFlowMessageModel.ProjectInfoId = Convert.ToInt16(ViewState["projectid"]);
            PmFlowMessageModel.FlowId = Convert.ToInt16(ViewState["flowid"]);
            PmFlowMessageModel.FormId = Convert.ToInt16(ViewState["formid"]);
            PmFlowMessageModel.NodeId = Convert.ToInt16(ViewState["nodeid"]);
            PmFlowMessageModel.MsgContent = txtMsg.Text + "<font color=red>(" + strMsg + ")</font>";
            PmFlowMessageModel.UserAccount = Session["UserAccount"].ToString();
            PmFlowMessageModel.UserName = Session["UserName"].ToString();
            PmFlowMessageModel.UserNameId = 1;
            PmFlowMessageBll.Add(PmFlowMessageModel);
        }
        /// <summary>
        /// 流程中加入下一个办理人
        /// </summary>
        /// <param name="NextNodeUserAccount">下一个办理人帐号</param>
        /// <param name="NextNodeUserName">下一个办理人姓名</param>
        /// <param name="NextNodeUserId">下一个办理人ID</param>
        private void InsertNextUser(string NextNodeUserAccount, string NextNodeUserName, int NextNodeUserId)
        {
            PmFlowReceiveModel.ProjectInfoId = Convert.ToInt16(ViewState["projectid"]);
            PmFlowReceiveModel.FlowId = Convert.ToInt16(ViewState["flowid"]);
            PmFlowReceiveModel.FlowFormId = Convert.ToInt16(ViewState["formid"]);
            PmFlowReceiveModel.FlowNodeId = Convert.ToInt16(NextNodeId);
            PmFlowReceiveModel.State = 1;
            PmFlowReceiveModel.UserAccount = NextNodeUserAccount;
            PmFlowReceiveModel.UserName = NextNodeUserName;
            PmFlowReceiveModel.UserNameId = NextNodeUserId;
            PmFlowReceiveBll.Add(PmFlowReceiveModel);
        }
        /// <summary>
        /// 发送RTX消息
        /// </summary>
        /// <param name="user">用户</param>
        /// <param name="msg">消息内容</param>
        private void SendRtx(string user, string msg)
        {
            //if (string.IsNullOrEmpty(user))
            //{
            //    user = "nobody";
            //}
            //RTXSAPILib.RTXSAPIRootObj RootObj = new RTXSAPIRootObj();     //创建根对象
            ////发入 RTX
            //RootObj.ServerIP = "192.168.17.222"; //设置服务器IP
            //RootObj.ServerPort = Convert.ToInt16("8006"); //设置服务器端口
            //RootObj.SendNotify(user, msg, 0, "http://oa.zjic.com");
        }

    }

}